<?

class FlatFeature {

	private $connection;
	
	function __construct() {
		$this->connection = mysql_connect('localhost','root','') or die(mysql_error());
		mysql_select_db('flats',$this->connection)  or die(mysql_error());
	}
	
	public function getTwoRoom()
	{

		$query = "SELECT * from flat_information LEFT JOIN  flat_positions ON flat_information.id = flat_positions.id WHERE rooms = 2";
		$res = mysql_query($query);
		$flats = array();
		while($row = mysql_fetch_assoc($res))
		{
			$flats[] = $row;
		}
		print_r($flats);exit;
		return $flats;
	}
	
	public function getTheeRoom()
	{
		$query = "SELECT * from flat_information LEFT JOIN flat_positions ON flat_information.id = flat_positions.id WHERE rooms = 3";
		$result = mysql_query($query) or die(mysql_error());
		$flats = array();
		while($row = mysql_fetch_assoc($res))
		{
			$flats[] = $row;
		}
		
		return $flats;
	}

	

}




?>